home *** CD-ROM | disk | FTP | other *** search
- ; Rio's Graphic Library
- ;
- ; gpset.asm
- ;
- ; 1992.6.13(Sat)
-
- public _gpset, gpset
- extrn _gwrtreg:near
-
- include grplib.inc
-
- assume cs:cseg
-
- dseg segment
-
- px dd 0
- py dd 0
- pcol dd 0
- plog dd 0
-
- dseg ends
-
- cseg segment
-
- ;---------------------------------------------------------------
- ; _gpset : 点の描画
- ; in AX,BX : 座標
- ; CX : 色
- ; DX : 演算指定(0=PSET 1=XOR)
- ;
- ; void gpset(int x, int y, int col, int mode)
- ;---------------------------------------------------------------
-
- align 4
-
- gpset proc
- mov ax,[esp+4]
- mov [px],ax
- mov ax,[esp+8]
- mov [py],ax
- mov ax,[esp+12]
- mov [pcol],ax
- mov ax,[esp+16]
- mov [plog],ax
- push dword ptr offset #retp
- mov al,[_nowscrmod]
- cmp al,2
- jle #nomode
- cmp al,4
- jle gpset_16
- cmp al,8
- jle gpset_32_1
- cmp al,11
- jle gpset_32_2
- cmp al,14
- jle gpset_256
- cmp al,18
- jle gpset_32_3
- #nomode: ret
- #retp: ret
- gpset endp
-
- align 4
-
- gpset_16 proc
- gpset_16 endp
-
- gpset_32_1 proc
- gpset_32_1 endp
-
- gpset_32_2 proc
- gpset_32_2 endp
-
- gpset_256 proc
- gpset_256 endp
-
- gpset_32_3 proc
- gpset_32_3 endp
-
-
-
-
-
-
- push ebx
- push esi
- mov al,[_nowscrmod]
- cmp al,2
- jle #end
- cmp al,4
- jle #mode16
- cmp al,8
- jle #mode32K_256
- cmp al,11
- jle #mode32K_512
- jmp #end
-
-
- #mode16:
- parmbase = 12
- mov ax,[esp+parmbase+4] ;y
- and eax,0ffffh
- lea eax,[eax*8]
- lea eax,[eax*8]
- lea eax,[eax*8]
- mov bx,[esp+parmbase] ;x
- and ebx,0ffffh
- mov ecx,ebx
- shr ebx,1
- add eax,ebx ;eax := アドレス
- bt ecx,0
- jnc #odd
- #even: mov ebx,0fh ;mask
- mov ecx,[esp+parmbase+8] ;color
- and ecx,0fh
- shl ecx,4
- jmp #m16_l1
- #odd: mov ebx,0f0h ;mask
- mov ecx,[esp+parmbase+8] ;color
- and ecx,0fh
- #m16_l1: push ds
- mov si,104h
- mov ds,si
- mov edx,[esp+parmbase+12] ;logop
- or edx,edx
- jnz #m16_xor
- #m16_normal: mov dl,ds:[eax]
- and dl,bl
- or dl,cl
- jmp #m16_l2
- #m16_xor: mov dl,ds:[eax]
- xor dl,cl
- #m16_l2: mov ds:[eax],dl
- pop ds
- jmp #end
-
- #mode32K_256:
- parmbase = 12
- mov ax,[esp+parmbase+4] ;y
- and eax,0ffffh
- lea eax,[eax*8]
- lea eax,[eax*8]
- lea eax,[eax*8]
- jmp #mode32K_
- #mode32K_512:
- parmbase = 12
- mov ax,[esp+parmbase+4] ;y
- and eax,0ffffh
- lea eax,[eax*8]
- lea eax,[eax*8]
- lea eax,[eax*8]
- add eax,eax
-
- #mode32K_:
- mov bx,[esp+parmbase] ;x
- and ebx,0ffffh
- add ebx,ebx
- add eax,ebx ;eax := address
- push ds
- parmbase = parmbase + 2
- mov bx,120h
- mov ds,bx
- mov bx,[esp+parmbase+12] ;logop
- or bx,bx
- jnz #m32_xor
- #m32_normal: mov bx,[esp+parmbase+8] ;col
- mov ds:[eax],bx
- jmp #m32_l1
- #m32_xor: mov bx,[esp+parmbase+8]
- xor ds:[eax],bx
- #m32_l1: pop ds
- jmp #end
-
- #end:
- pop esi
- pop ebx
- ret
-
- ; push ebx
- ; mov ax,[esp+8]
- ; mov bx,[esp+12]
- ; mov cx,[esp+16]
- ; mov dx,[esp+20]
- ; call _gpset
- ; pop ebx
- ; ret
- gpset endp
-
- align 4
-
- _gpset proc
- pushad
- mov di,dx ;DI := 演算指定
- mov si,cx ;SI := カラーコード
- mov cl,[_nowscrmod]
- cmp cl,2
- jle #end
- cmp cl,4
- jle #mode0
- cmp cl,8
- jle #mode2
- cmp cl,11
- jle #mode1
- jmp #end
- #mode0: ; 《仮想画面 1024*512,16色モード》
- mov ecx,eax
- and ecx,7
- lea ecx,[ecx*4] ;ESI := 書き込むピクセルデータ
- shl esi,cl
- mov ebp,1111b ;EBP := マスクパターン
- shl ebp,cl
- and ebx,0ffffh ;EBX := アドレス
- lea ebx,[ebx*8]
- lea ebx,[ebx*8]
- lea ebx,[ebx*8]
- and eax,0fff8h
- shr eax,1
- add ebx,eax
- mov al,[_wrtpage]
- or al,al
- jz #mode0_page0
- add ebx,40000h
- #mode0_page0: ;
- xor ax,ax ;マスクレジスタ書き込み
- mov edx,ebp
- call _gwrtreg
- push ds ;VRAM 書き込み
- mov ax,104h
- mov ds,ax
- or di,di ;(演算指定により分岐)
- jnz #mode0_xor
- mov ds:[ebx],esi
- jmp #mode0_end
- #mode0_xor: xor ds:[ebx],esi
- #mode0_end: pop ds
- jmp #end
- #mode1: ; 《仮想画面 512*256,32768色モード》
- and ebx,0ffffh ;EBX := アドレス
- lea ebx,[ebx*8]
- lea ebx,[ebx*8]
- lea ebx,[ebx*8]
- lea ebx,[ebx*2]
- and eax,0ffffh
- add eax,eax
- add ebx,eax
- mov al,[_wrtpage]
- or al,al
- jz #mode1_page0
- add ebx,40000h
- #mode1_page0: ;
- push ds
- mov ax,104h
- mov ds,ax
- or di,di
- jnz #mode1_xor
- mov ds:[ebx],si
- jmp #mode1_end
- #mode1_xor: xor ds:[ebx],si
- #mode1_end: pop ds
- jmp #end
- #mode2: ; 《仮想画面 256*512,32768色モード》
- and ebx,0ffffh ;EBX := アドレス
- lea ebx,[ebx*8]
- lea ebx,[ebx*8]
- lea ebx,[ebx*8]
- and eax,0ffffh
- add eax,eax
- add ebx,eax
- mov al,[_wrtpage]
- or al,al
- jz #mode2_page0
- add ebx,40000h
- #mode2_page0: ;
- push ds
- mov ax,104h
- mov ds,ax
- or di,di
- jnz #mode2_xor
- mov ds:[ebx],si
- jmp #mode2_end
- #mode2_xor: xor ds:[ebx],si
- #mode2_end: pop ds
- #end: ; 後処理
- popad
- ret
- _gpset endp
-
- cseg ends
-
- end
-